{include file="public/header" /}
<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="good_add.html"> 添加内容</a> </li>
        <form action="{:url('')}" id="F" method="get">
        <li>搜索：</li>

        <li>首页</li>
       <li>

          <input type="radio" name="recommended" {if ''==$recommended}checked{/if} value="">全部
          <input type="radio" name="recommended" {if '1'===$recommended}checked{/if} value="1">首页推荐
          <input type="radio" name="recommended" {if '0'===$recommended}checked{/if} value="0">首页不推荐

        </li>
          <li>

          </li>
          <li>

          <input type="checkbox" name="if_show[]" {if in_array(1,$if_show)}checked{/if} value="1">未下架
          <input type="checkbox" name="if_show[]" {if in_array(0,$if_show)}checked{/if} value="0">下架

       	 </li>
          <li>
            下单时间:
            <input type="date" name="mintime" value="{$mintime}">
            ----
            <input type="date" name="maxtime" value="{$maxtime}">
          </li>
          <li>
            金额:
            <input type="number" name="minmoney" value="{$minmoney}">
            ----
            <input type="number" name="maxmoney" value="{$maxmoney}">
          </li>
          <li>
            品牌:
            <select name="b_brand" id="">
              <option value="">请选择</option>
              {foreach $brand as $v}
               <option value="{$v['brand_id']}" {if $v['brand_id']==$b_brand}selected{/if}>{$v['brand_name']}</option>
              {/foreach}
            </select>
          </li>
          <li>
          	<select name="pid" style="padding:5px 15px; border:1px solid #ddd;">
              <option value="">请选择分类</option>
                {foreach name='cate' item='v'}
              <optgroup label="{$v['cate_name']}">

                    {foreach name="$v['next']" item='vv' empty=''}
                  <optgroup label="{$vv['cate_name']}">

                      {foreach name="$vv['next']" item='vvv' empty=''}
                      <option value="{$vvv['cate_id']}" {if $vvv['cate_id']==$pid}selected{/if} >|------{$vvv['cate_name']}</option>
                      {/foreach}

                  </optgroup>
                   {/foreach}

              </optgroup>
                {/foreach}

          	</select>
          </li>
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:200px; line-height:17px;display:inline-block" value="{$keywords}"/>
          <a href="javascript:F.submit();" class="button border-main icon-search" > 搜索</a></li>
      </ul>
      </form>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>       
        <th width="15%">商品名称</th>
        <th>图片</th>
        <th>价格</th>        
        <th>分类名称</th>
        <th>所属品牌</th>
        <th><a href="{:url('',['cid'=>$cid+1,'keywords'=>$keywords,'if_show'=>$if_show,'recommended'=>$recommended,
        'mintime'=>$mintime,'maxtime'=>$maxtime,'minmoney'=>$minmoney,'maxmoney'=>$maxmoney])}">上架时间&nbsp{$msg}</a></th>
        <th>推荐</th>
        <th>热门</th>
        <th>下架</th>
        <th width="310">操作</th>
      </tr>
        {foreach $sel as $v}
      <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="" />{$v['goods_id']}</td>
          <td>{$v['goods_name']|raw|str_replace=$keywords,"<span style='color: red;'>$keywords</span>",###}}</td>
          <td width="10%"><img src="__IMAGES__/{$v['brand_logo']?$v['default_image']:'default.png'}" alt="" width="70" height="50" /></td>
          <td>{$v['price']}</td>
          <td>{$v['cate_name']}</td>
          <td>{$v['brand_name']}</td>
          <td>{$v['add_time']|raw}</td>
          <td>{$v['recommended']|raw}</td>
          <td>{$v['if_hot']|raw}</td>
          <td>{$v['if_show']}</td>
          <td><div class="button-group">
            <a class="button border-main" href="{:url('goodEdit',['goods_id'=>$v['goods_id']])}"><span class="icon-edit"></span> 修改</a>
            <a class="button border-red" href="javascript:void(0)" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
        {/foreach}
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="9" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a> 操作：
          <select name="ishome" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeishome(this)">
            <option value="">首页</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
          <select name="isvouch" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeisvouch(this)">
            <option value="">推荐</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
          <select name="istop" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeistop(this)">
            <option value="">下架</option>
            <option value="1">是</option>
            <option value="0">否</option>
          </select>
        </td>
      </tr>

    </table>

      <tr>
          <td colspan="9" class="pagelist">{$page|raw}</div></td>
      </tr>

  </div>
<script type="text/javascript">

//搜索
function changesearch(){	
		
}

//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要删除吗?")){
		
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");	
		
		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		
		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}		
	    });
		if(i>1){ 
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{
		
			$("#listform").submit();		
		}	
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>
</body>
</html>